<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
    <head>
    <meta charset="utf-8">
    <title>大数据管理平台</title>
    <meta charset="UTF-8">
    <link href="../css/BigData.css" rel="stylesheet" type="text/css" />
    <link href="../css/index.css" rel="stylesheet" type="text/css" />
    <link href="../css/index01.css" rel="stylesheet" type="text/css" />
    <link href="../css/Security_operation.css" rel="stylesheet" type="text/css" />
    <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    </head>
    <body text="red">
        <div class="data_tit3">经理任务情况分析</div>
        <table class="table_data01" id="classTb1" style="color: #080808">
            <tr>
                <td>项目经理:</td>
                <td>课程名称:</td>
                <td>作业次数:</td>
            </tr>
        </table>
        <div id="main" style="width: 1000px;height:700px;"></div>
</body>
</html>
<script src="../js/echarts-all.js"></script>
<script src="../js/jquery.js"></script>
<script type="text/javascript">
    //发送异步请求，获取当周各个项目作业次数
    $(function(){
        $.ajax({
            url:"/manager/analysis/CoreSumOfWeek",
            type:"get",
            dataType:"json",
            success:function (data) {
                //局部刷新表格数据
                console.log(data);
                if(data != null){
                    $.each(data,function (index,item) {
                        $("#classTb1").append("<tr>" +
                            "<td>"+item.f_master+"</td>" +
                            "<td>"+item.f_coretask+"</td>" +
                            "<td>"+item.num1+"</td>" +
                            "</tr>");
                    });
                }
            }
        });
    });
    //项目经理发布考核次数
    $(function() {
        var myChart = echarts.init(document.getElementById('main'));
        var option = {
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
                axisLabel: {
                    textStyle: {
                        color: '#000000',
                    },
                },
            },
            yAxis: {
                axisLabel: {
                    textStyle: {
                        color: '#000000',
                    },
                },
                type: 'value'
            },
            series: [{
                data: [150, 230, 224, 218, 135],
                type: 'line'
            }]
        }
        myChart.setOption(option);
        $.ajax({url:"/manager/analysis/CoreSumOfMaster",
            type:"get",
            dataType:"json",
            success:function (data) {
                //局部刷新表格数据
                console.log(data);
                var arr = [];
                var arr1 =[];
                //循环遍历服务器返回的数组对象
                for(var i = 0; i < data.length; i++){
                    //获取每一个数组元素
                    var  obj = data[i];
                    //获取obj对象的属性值
                    var classname = obj.f_master;
                    var num2 = obj.num;
                    arr[i] = classname;
                    arr1[i] = num2;
                }
                console.log(arr);
                myChart.setOption({
                    xAxis:[{
                        data:arr
                    }],
                    series:[{
                        data:arr1
                    }]
                })
            },
            error:function () {
                alert("异步交互失败")
            }
        })
    });
</script>
